﻿using System;
using System.Collections.Generic;
using System.Xml;
using umbraco.MacroEngines;
using umbraco.MacroEngines.Library;

namespace uComponents.RazorModels.CountryPicker
{
	[RazorDataTypeModel("BF1A6031-DBA9-4249-9BAA-9124974EB09D")]
	public class CountryPickerModelBinder : IRazorDataTypeModel
	{
		public bool Init(int CurrentNodeId, string PropertyData, out object instance)
		{
			var values = new List<string>();

			if (!string.IsNullOrEmpty(PropertyData))
			{
				foreach (var value in PropertyData.Split(','))
				{
					values.Add(value);
				}
			}

			instance = values;

			return true;
		}
	}
}
